<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js" lang="en"><!--<![endif]-->

<head>
	<meta charset="utf-8" />
	<!-- Set the viewport width to device width for mobile -->
	<meta name="viewport" content="width=device-width" /> 
	<title>เกมส์ทายผลฟุตบอล ชิงเงินรางวัล iFunSoccer</title>
	<meta name="Description" content="เกมส์ทายผลฟุตบอล ชิงรางวัลมากมายรวมมูลค่ากว่า 3แสนบาท เส้นทางสู่วิเคราะห์ฟุตบอลมืออาชีพ มีฟุตบอลให้ทำนายผลตลอด 24 ชั่วโมง">
	<meta name="keywords" content="เกมส์, เกมส์ทายผล, เกมส์ทายผลบอล, เกมส์ทายผลฟุตบอล, เกมส์ทายผลบอล ชิงรางวัล, เกมส์ทายผลฟุตบอล ชิงรางวัล">
	<!-- Included CSS Files -->
	<link rel="stylesheet" type="text/css" href="/css/fonts/supermarket.css">
	<link rel="stylesheet" href="/css/normalize.css" />
	<link rel="stylesheet" href="/css/foundation.css" />
	<link rel="stylesheet" type="text/css" href="/css/app.css">
	<link rel="stylesheet" type="text/css" href="/css/fonts/genericons.css">
	<link rel="stylesheet" type="text/css" href="/css/foundation_icons_general/stylesheets/general_foundicons.css">
	<!--[if lt IE 8]>
	<link rel="stylesheet" href="/css/foundation_icons_general/stylesheets/general_foundicons_ie7.css">
	<![endif]-->
	<link rel="stylesheet" type="text/css" href="/css/ifs.css">
	<!-- RWD Table -->
	
	<link href="/css/footable-0.1.css" rel="stylesheet" type="text/css" />
	<link href="/css/footable.sortable-0.1.css" rel="stylesheet" type="text/css" />
    <script src="/js/json2.js" type="text/javascript"></script> 

	<link rel="icon" href="/img/favicon.png" type="image/png" />
	<link rel="shortcut icon" href="/favicon.ico" />


<style>
    article, aside, figure, footer, header, hgroup,
    menu, nav, section {
        display: block;
    }

    .on {
         
        background: #e5e696; /* Old browsers */
        background: -moz-linear-gradient(top,  #e5e696 0%, #d1d360 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e5e696), color-stop(100%,#d1d360)); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top,  #e5e696 0%,#d1d360 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top,  #e5e696 0%,#d1d360 100%); /* Opera 11.10+ */
        background: -ms-linear-gradient(top,  #e5e696 0%,#d1d360 100%); /* IE10+ */
        background: linear-gradient(to bottom,  #e5e696 0%,#d1d360 100%); /* W3C */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e5e696', endColorstr='#d1d360',GradientType=0 ); /* IE6-9 */

    }

    .played {
        background-color: #D1D0CE;
        color: #ffffff;
    }

    .tdItem {
        background-color: #eee;
        padding: 5px;
        cursor: pointer;
    }

    .ui-selecting {
        background: #FECA40;
    }

    .ui-selected {
        background: #F39814;
    }
</style>
	
</head>
<body ontouchstart=""  >

<h1>เกมส์ทายผลฟุตบอล ชิงเงินรางวัล iFunSoccer</h1>
         <div id="fb-root"></div>
  <!-- body content here -->
<div id="header" class="row" style="overflow:visible;">
	<div class="large-3 large-offset-1 columns">
		<a href="/"><img id="logo" alt="IFunSoccer.com" src="/img/iFunSoccer-logo.png"></a>
	</div>
	<div style="padding-right:0" id="header-right" class="large-8 columns">
		<div class="bg">
			<ul id="topmenu">
				<li class="pic"><a target="_blank" title="Find IFunSoccer on Facebook" href="https://www.facebook.com/iFunsoccer"> <i class="genericon genericon-facebook"></i></a></li>
                <li class="pic"><a target="_blank" title="Follow IFunSoccer on Twitter" href="https://twitter.com/iFunsoccer"> <i class="genericon genericon-twitter"></i></a></li>
                <li class="pic"><a target="_blank" title="Find IFunSoccer on Google+" href="https://plus.google.com/113048931169882783123"> <i class="genericon genericon-googleplus"></i></a></li>
                <li class="pic"><a target="_blank" title="See IFunSoccer on Youtube" href="http://www.youtube.com/iFunSoccer"> <i class="genericon genericon-youtube"></i></a></li>
			</ul>
		</div>
		<!-- Stick Control -->
		<div class="contain-to-grid sticky"   >
		<nav class="top-bar" data-options="is_hover:false">

		  <ul class="title-area">
		  <!-- Title Area -->
			<li class="name">
				<h1><a href="#">iFunSoccer.com</a></h1>
			</li>
			<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
			<li class="toggle-topbar menu-icon"><a href="#"><span style="font-size:1.75em; font-family:'supermarketRegular';">เมนู</span></a></li>
		  </ul>
		
		  <section class="top-bar-section">
			<!-- Left Nav Section -->
			<ul class="left">
			  <li class="divider"></li>
			  <li class="has-dropdown"><a href="/index.html"><i class="foundicon-home" style="vertical-align:middle;"></i> หน้าแรก</a>
				<ul class="dropdown">
					<li><a href="/index.html"><i class="foundicon-home" style="vertical-align:middle;"></i> หน้าแรก</a>
					<li><a title="รางวัล" href="/reward.html"><i class="foundicon-smiley" style="vertical-align:middle;"></i> รางวัล</a></li>
					 <li><a title="สถิติทีเด็ด" href="/stat-today.html"><i class="foundicon-graph" style="vertical-align:middle;"></i> สถิติทีเด็ด</a></li>
				</ul>
			  </li>
			  <li class="divider"></li>
			  <li class="has-dropdown">
				<a title="หน้าแรก สมาชิก" href="/member-home.html"><img id="memberPicture" src="/img/thumb_fb_profile.png"> <span id="memberName"> </a>
				<ul class="dropdown">
					<li><a href="/member-home.html"><i class="foundicon-heart" style="vertical-align:middle;"></i> หน้าแรกสมาชิก</a></li>
					<li><a href="/member-edt.html"><i class="foundicon-settings" style="vertical-align:middle;"></i> แก้ไขข้อมูลสมาชิก</a></li>
					<li><a onclick="logout()" ><i class="foundicon-unlock" style="vertical-align:middle;"></i> ออกจากระบบ</a></li>
				</ul>
			  </li>
			  <li class="divider"></li>
			  <li class="has-dropdown active">
				<a title="เกมส์ทายผลฟุตบอล" href="/game.html"><i class="foundicon-website" style="vertical-align:middle;"></i> เกมส์ทายผลฟุตบอล</a>
				<ul class="dropdown">
					<li class="active"><a title="โปรแกรมฟุตบอลวันนี้" href="/game.html"><i class="foundicon-calendar" style="vertical-align:middle;"></i> โปรแกรมฟุตบอลวันนี้</a></li>
					<li><a href="/play-list.html"><i class="foundicon-page" style="vertical-align:middle;"></i> รายการที่เล่น</a></li>
					<li><a href="/game-rules.html"><i class="foundicon-flag" style="vertical-align:middle;"></i> กฏกติกาการเล่นเกมส์</a></li>
					<li><a href="/game-achievements.html"><i class="foundicon-idea" style="vertical-align:middle;"></i> รายการความสำเร็จ</a></li>
					<li><a href="invite"><i class="foundicon-star" style="vertical-align:middle;"></i> ขอดาวจากเพื่อน</a></li>
				</ul>
			  </li>
			  <li class="divider"></li>
			  <li><a title="ติดต่อ" href="/contact.html"><i class="foundicon-mail" style="vertical-align:middle;"></i> ติดต่อ</a></li>
			</ul>
		  </section>
		  
		</nav>
	</div>
		
	</div>
</div>
 
<!-- Orbit container -->  
<div class="row">
  <div class="small-10 small-centered columns">
    <div class="slideshow-wrapper">
      <div class="preloader"></div>
          <ul data-orbit>
            <!-- Orbit slides -->
            <li>
            <img src="/img/iFunSoccer-promo-banner-1.png" />
             <!--<div class="orbit-caption">คัดเลือก เฟ้นหาแชมป์ตัวจริงกับเราวันที่ 1สิงหาคมนี้ เป็นต้นไป</div> -->
          </li>
          <li>
            <img src="/img/iFunSoccer-promo-banner-2.png" />
            <!--<div class="orbit-caption">เกมส์ทายผลฟุตบอลที่สามารถผ่านบัญชี Facebook </div> -->
          </li>
          <li>
            <img src="/img/iFunSoccer-promo-banner-3.png" />
            <!--<div class="orbit-caption">iFunSoccer ขอเชิญทุกท่านร่วมเป็นส่วนหนึ่งของ เกมส์ทายผลฟุตบอลใหม่ล่าสุดเล่นได้ทุกที่ทุกเวลา</div> -->
          </li>
          <li>
            <img src="/img/iFunSoccer-promo-banner-4.png" />
            <!--<div class="orbit-caption">เส้นทางสู่นักวิเคราะห์ฟุตบอลมืออาชีพ เปิดประสบการณ์ใหม่ สาวกลูกหนังห้ามพลาด</div> -->
          </li>
          </ul>
       </div>
    </div>
</div>
<!-- Orbit container -->  

<!-- Content container -->    
<div class="row" id="content">
	<div class="small-10 large-centered columns" style="background-color:#FFFFFF">
		<!-- Page Title -->
		<div class="row">
			<div class="large-4 columns" style="padding-right:2em">
				<div class="hbg">
					<h3>เกมส์ทายผลฟุตบอล</h3>
				</div>
			</div>
		</div>
		<!-- Content container 1st row --> 
			<div class="row">
			  <div class="large-12 columns">
                <div class="row">
                      <div class="sidebox-full mypoints-box-header-full">
                        <h4>คะแนนของฉัน</h4>
                        <div class="row">
                           <div class="small-6 columns">
                               <h5>
                                    <img src="img/badge-point.png"> <span id="point" ></span> <span style="color:#000">คะแนน</span>
                               </h5>
                           </div>
                           <div class="small-6 columns">
                               <h5>
                                    <img src="img/badge-star.png"> <span id="star" ></span> <span style="color:#000">คะแนน</span>
                               </h5>
                           </div>
    					 </div>
                      </div>
                    </div>
					
					 <!-- game table styles -->       
					<div>
					    
                        
						<h4>โปรแกรมฟุตบอลวันนี้</h4>
						<div class="row">
							  <div class="large-12 columns"><input id="filter" type="text" placeholder="พิมพ์หา เช่น ชื่อลีก ชื่อทีม" /> <!--<a href="#clear" class="clear-filter" title="clear filter">ล้าง</a> --></div>
                              <select onchange="getmatch(this.value,'func')" id="selectleague">
                                    <option>All</option>
                                </select> 
						 </div>
						<div class="row">
							<!-- CSS3 Data Grids --> 
                          <!--  <select onchange="getmatch(this.value,'func')" id="select1">
                            getmatch(function () { $('table').footable(); });
                            getmatch(this.value,function () { $('table').footable(); })-->

							<table data-filter="#filter" class="footable">
							  <thead>
								<tr>
                                  <th data-class="expand">No</th>
								  <th data-hide="phone,tablet" data-sort-initial="true">ลีก/ถ้วย</th>
								  <th data-hide="phone,tablet">Kick Off</th>
								  <th>ทีมเจ้าบ้าน</th>
								  <th data-hide="phone" data-type="numeric">แต้มต่อรอง</th>
								  <th>ทีมเยือน</th>
								  <th data-hide="phone">ชิงรางวัล</th>
								  <th data-hide="phone,tablet">ความมั่นใจ</th>
                                  <th data-hide="phone,tablet">ยืนยัน</th>
								</tr>
							  </thead> 
                                <tbody  id="tddetail"> </tbody>  
							</table>
							<!-- /CSS3 Data Grids -->
						</div>
						<div class="game-table-row">
							
				  </div>
				</div>
				
			  </div>
			  
			  </div>
			  
			</div>
		
	</div>

<!--</div>-->

<!-- Bottom container --> 	
<div class="row" id="bottom">    
	<div class="small-10 large-centered columns">        
		<div class="row">            
			<div class="large-5 columns" style="padding-right:2em">                
				<div class="hbggray">
					<h3>ข่าวสารจากiFunSoccer</h3>
				</div>
			</div>
		</div>        
		<div class="row">            
			<div class="large-4 columns" style="padding-right:2em">
				<h4>Follow iFunSoccer</h4>                
				<p>พบกับกิจกรรมร่วมสนุกมากมายในแฟนเพจ iFunSoccer</p>                
				<div class="follow-btns">                    
					<a target="_blank" title="Follow IFunSoccer on Facebook" href="https://www.facebook.com/iFunsoccer"><i class="genericon genericon-facebook"></i></a>                    
                    <a target="_blank" title="Follow IFunSoccer on Twitter" href="https://www.twitter.com/iFunsoccer"><i class="genericon genericon-twitter"></i></a>                    
                    <a target="_blank" title="Follow IFunSoccer on Google+" href="https://plus.google.com/113048931169882783123"><i class="genericon genericon-googleplus"></i></a>                    
                    <a target="_blank" title="See IFunSoccer on Youtube" href="https://www.youtube.com/iFunsoccer"><i class="genericon genericon-youtube"></i></a>                
				</div>            
			</div>            
			<div class="large-4 columns" style="padding-right:2em">
				<h4>Newsletter</h4>                
				<p>รับข่าวส่ารผ่านทางอีเมล</p>                
				<div class="row">
					<div id="newsletterform">
                        <div class="eight mobile-three columns">
                            <input type="email" name="" value="" placeholder="your email address"  id="nwsmail" />
                        </div>
                        <div class="four mobile-one columns">
                            <input type="submit" class="button" value="สมัคร" onclick="return sendemailletter(2,$('#nwsmail').val())"   />
                        </div>                    
                    </div>
				</div>
			</div>
			<div class="large-4 columns contact">
				<a href="contact.html"><img src="/img/iFunSoccer-bottom-contact.png" id="contact-me" alt="ติดต่อเรา" /></a>
			</div>
		</div>
	</div>
</div>

<!-- Bottom menu container for small screen--> 
<ul id="bottommenu">
	<li id="home"><a href="/index.html"><i class="foundicon-home" style="vertical-align:middle;"></i> หน้าแรก</a></li>
	<li><a href="/member-home.html""><i class="foundicon-heart" style="vertical-align:middle;"></i> หน้าแรกสมาชิก</a></li>
	<li><a href="/game.html" class="active title="เกมส์ทายผลฟุตบอล"><i class="foundicon-star" style="vertical-align:middle;"></i> เกมส์ทายผลฟุตบอล</a></li>
	<li><a href="/reward.html" title="รางวัล"><i class="foundicon-smiley" style="vertical-align:middle;"></i> รางวัล</a></li>
	<li><a href="/stat-today.html" title="สถิติทีเด็ด"><i class="foundicon-graph" style="vertical-align:middle;"></i> สถิติทีเด็ด</a></li>
	<li><a href="/contact.html" title="ติดต่อ"><i class="foundicon-mail" style="vertical-align:middle;"></i> ติดต่อ</a></li>
</ul>

<!-- Footer container--> 
<div class="row" id="footer">
	<ul id="footermenu">
		<li><a href="http://www.iFunSoccer.com">&copy; 2013 iFunSoccer.com</a></li>
		<li><a href="/disclaimer.html">นโยบายการใช้งาน</a></li>
		<li><img src="/img/icon-truehits.gif"></li>
		<li>iFunSoccer เป็นแค่เกมส์ใช้เพื่อความบันเทิงเท่านั้น ทีมงานผู้จัดทำไม่สนันสนุนให้มีการเล่นพนันหรือเกี่ยวข้องกับการพนัน การดำเนินการใดๆที่นำเอาเนื้อหา และโฆษณา จากเว็บไซต์นี้ไปใช้ประโยชน์ในทางที่ผิด ทางทีมงานผู้จัดทำจะไม่รับผิดชอบใดๆทั้งสิ้น</li>
	</ul>
</div>
<script src="/js/jquery.min.js" type="text/javascript"></script>
	<script src="/js/table/footable.js" type="text/javascript"></script>
	<script src="/js/table/footable.sortable.js" type="text/javascript"></script>
	<script src="/js/table/footable.filter.js" type="text/javascript"></script>
	<script src="/js/vendor/custom.modernizr.js" type="text/javascript" ></script> 
    <script src="/js/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script> 
    <script src="/js/contactus.js" type="text/javascript"></script>
    <script src="/js/chklogin.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            getleague();
            getprofile(); 
            getmatch('', function () {
                $('table').footable();
            });
        });

        var urlstr = 'IFS/ifs.ashx';

        function getprofile() {
            $.ajax({
                url: 'SSEHandler.ashx',
                async: false,
                type: 'GET',
                dataType: "json",
                data: { method: 'getprofile' },
                success: function (json) {

                    for (var i = 0; i < json.length; i++) {
                        //alert(json[i].Curent_Star);
                        //$('#memberName').text(json[i].Email);
                        $('#point').text(json[i].Curent_Point);
                        $('#star').text(json[i].Curent_Star);
                    }
                }
            });
        }

        function getplaylistcheckplayed(matchid) {

            var retval = 0;

            $.ajax({
                url: 'SSEHandler.ashx',
                async: false,
                type: 'GET',
                dataType: "json",
                data: { method: 'chkplaylist' },
                success: function (json) {
                    //                    for (var i = 0; i < json.length; i++) {
                    //                        alert(json[i].matchid + ':' + matchid);
                    //                        if (json[i].matchid == matchid) {
                    //                            retval = 1;
                    //                            alert(retval);
                    //                        }
                    //                    }

                    retval = json;

                }
            }); 

             return retval
        }

        function getleague() {

            //alert(timestamp);
            var now = new Date();
            var parameter;
            var Pleagueid = '';
            //parameter = 'metdhodName':'getmatchscore','matchDate': now ; 
            ////data: { metdhodName: 'getmatchscore', matchDate: timestamp }, 
            parameter = { 'metdhodName': 'getmatchscore', 'matchDate': now };
            var dateString = JSON.stringify(now); 
            //data: { metdhodName: 'getmatchscore', matchDate: dateString },
            $.ajax({
                url: urlstr,
                type: 'GET',
                dataType: 'json',
                data: { metdhodName: 'getmatchscore', matchDate: dateString },
                success: function (json) {

                    var select = document.getElementById("selectleague");
                    var categories = [];

                    $.each(json, function (index, value) {
                        if ($.inArray(value.l.name, categories) == -1)
                         {
                            var c = categories.push(value.l.name); 
                            var el = document.createElement("option");
                            el.textContent = value.l.descriptionTh;
                            el.value = value.l.name;
                            select.appendChild(el); 
                        }
                    });

                    //var uniqueGroups = {};  
                    //$.each(json, function () {
                    //    uniqueGroups[this.l.name] = this.l.descriptionTh;  
                    //}); 

                }
            });
        } 


        function savegame(parame, objtd) {

            var betstar = 0;
            var arraypara = parame;

            //alert($(objtd).hasClass('on')); 
            //alert($(objtd).closest('tr').find('.on'));

            alert($("#star" + parame + "").val());

            //alert(parame);


            if ($(objtd).hasClass('on') == false) {
                alert('กรุณาเลือกทีมก่อน'); 
                return false;
            } 



            $(objtd).closest('tr').find("input").each(function () {
                betstar = this.value;
            });

            if (parseInt(betstar) > parseInt($('#star').text())) {
                alert('จำนวนดาวของคุณไม่พอเล่น');
                return;
            }

            if (betstar == 0) // no input star 
            {
                return;
            }

            if ($(objtd).hasClass('on')) { } else { return false; } // no click select team  

            if (!confirm("ยืนยัน")) { return false; }

            arraypara = parame.split(',');

            //for (i = 0; i < arraypara.length; i++) { alert("<br /> Element " + i + " = " + arraypara[i]); }

            var Pleagueid;
            var Pmatchid;
            var PCurrent_TeamHandicap;
            var PCurrent_PriceHandicap;
            var PHometeam = 'liveA';
            var PTeamselect;
            var Psaveteam = 'liveA';

            Pleagueid = arraypara[1];
            Pmatchid = arraypara[2];
            PCurrent_TeamHandicap = arraypara[3];
            PCurrent_PriceHandicap = arraypara[4];
            PHometeam = arraypara[5];

            //=================
            if ($(objtd).hasClass('on')) // clicked select team  // stamp teamA or teamB
            {
                PTeamselect = $('#tddetail td.on').text();

                if ($.trim(PTeamselect) != $.trim(PHometeam)) {
                    Psaveteam = 'liveB';
                }

                $(objtd).closest('tr').find("button").attr("disabled", true);
                $(objtd).addClass('played');
            }


            //=================
            if ($(objtd).hasClass('on')) // click select team 
            {
                $.ajax({
                    url: 'SSEHandler.ashx',
                    type: 'GET',
                    dataType: 'json',
                    data: {
                        method: 'savegame',
                        memid: '1',
                        leagueid: Pleagueid,
                        matchid: Pmatchid,
                        selectteam: Psaveteam,
                        selectteamid: '1',
                        StarBet: betstar,
                        Current_PriceHandicap: PCurrent_PriceHandicap,
                        Current_TeamHandicap: PCurrent_TeamHandicap
                    },
                    success: function (data) {
                        if (data.result == 'true') {
                            alert(data.msg);
                            getprofile();
                        }
                    }
                });
                 
            }
            
        } 

        function formatDate(val) {
            if (val === null || val === '') {
                return null;
            }
            else {

                var d = new Date(parseInt(val.substr(6)));
                 
                return jQuery.datepicker.formatDate('dd-MM-yy', d) + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
                //return d
            }
         }
           
         

        function addclasscss() {
            $(this).addClass('on');
        }


        function addclasss(val, valx) {

            if ($(val).hasClass('on')) {
                return false;
            }

            $(val).parents('table').find('td').removeClass('on');
            $(val).addClass('on');
        }

        function numericFilter(txb) {
            txb.value = txb.value.replace(/[^\0-9]/ig, "");
        }
        function isNumber(evt) {
            evt = (evt) ? evt : window.event;
            var charCode = (evt.which) ? evt.which : evt.keyCode;
            if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }
            return true;
        }

        function findIndexByKeyValue(obj, key, value) {
            for (var i = 0; i < obj.length; i++) {
                if (obj[i][key] == value) {
                    return i;
                }
            }
            return null;
        }

        function retexisted(json, matchid) {
            var retval = 0;
            for (var i = 0; i < json.length; i++) { 
                if (json[i].matchid == matchid) {
                    return retval = 1; 
                }
            }

            return retval;
        }

        function addcssplayed(objtd) {
            $(objtd).closest('tr').find("button").attr("disabled", true);
            $(objtd).addClass('played');
        }

        function getmatch(leagueid, func) {
         

             //var timestamp = $.now();
             //alert(timestamp);
             var now = new Date();
             var parameter;
             var Pleagueid = '';
              //parameter = 'metdhodName':'getmatchscore','matchDate': now ; 
             ////data: { metdhodName: 'getmatchscore', matchDate: timestamp }, 
             //parameter = {'metdhodName':'getmatchscore','matchDate': now};
             var dateString = JSON.stringify(now);
             //var datax = JSON.stringify(parameter);
             var dateString = JSON.stringify(now);

             if (leagueid != null) {
                 Pleagueid = leagueid;
             }

             if (leagueid == 'All') {
                 Pleagueid = '';
             }

             var objplayed = getplaylistcheckplayed(1) 

             $.ajax({
                 url: urlstr,
                 type: 'GET',
                 dataType: 'json',
                 data: { metdhodName: 'getmatchscore', matchDate: dateString, leagues: Pleagueid },
                 success: function (json) {
                     $("#tddetail").empty();

                     for (var i = 0; i < json.length; i++) {

                         var chk = retexisted(objplayed, json[i]['matches'].id);
                         var styleexited = '';
                         var stylebtn = '';

                         if (chk == 1) {
                             styleexited = 'class=played';
                             stylebtn = 'disabled';
                         }
                           
                         var sx = json[i]['price'].sx;
                         var sy = json[i]['price'].sy;
                         var teamhandycapA = 'style=color:#039';
                         var teamhandycapB = 'style=color:#039';
                         var Currentteamhandycap = 'liveA';
                         var pricehandycap = json[i]['price'].rq;

                         //alert(sy + ":" + sx);

                         if (sy > sx) {
                             teamhandycapA = 'style=color:#C00';
                             teamhandycapB = 'style=color:#039';
                             Currentteamhandycap = 'liveA';
                         }
                         else if ((sy == 1) && (sx == 1)) {
                             teamhandycapA = 'style=color:#039';
                             teamhandycapB = 'style=color:#C00';
                             Currentteamhandycap = 'liveB';
                         }
                         else if ((sy == '-99') && (sx == '-99')) {
                             teamhandycapA = 'style=color:#039';
                             teamhandycapB = 'style=color:#039';
                             Currentteamhandycap = 'liveA';
                         }
                         else if ((sy == '-99') && (sx == '0')) {
                             teamhandycapA = 'style=color:#039';
                             teamhandycapB = 'style=color:#039';
                             Currentteamhandycap = 'liveA';
                         }

                         if (pricehandycap == '-99') {
                             pricehandycap = 0;
                         }

                         //alert(json[i]['matches'].isFinish);

                         if (json[i]['matches'].isFinish == false) {

                              $("#tddetail").append("<tr><td>" + json[i]['matches'].leagueName + "</td> \r\n \n\
                                                        <td>" + formatDate(json[i]['matches'].matchTime) + "</td> \r\n \n\
                                                        <td onclick=addclasss(this,this.innerHTML) " + teamhandycapA + " > " + json[i]['matches'].liveA + "</td> \r\n\n\
                                                        <td>" + pricehandycap + "</td> \r\n\n\
                                                        <td onclick=addclasss(this,this.innerHTML) " + teamhandycapB + " > " + json[i]['matches'].liveB + "</td> \r\n\n\
                                                        <td><img src=img/small/icon-super-winner.png alt=แชมป์ผู้มีคะแนนสะสมสูงสุด รวมทุกลีก/ถ้วย title=แชมป์ผู้มีคะแนนสะสมสูงสุด รวมทุกลีก/ถ้วย> <img src=img/small/icon-star-winner.png alt=แชมป์ผู้มีคะแนนดาวสะสมสูงสุด รวมทุกลีก/ถ้วย title=แชมป์ผู้มีคะแนนดาวสะสมสูงสุด รวมทุกลีก/ถ้วย> <img src=img/small/icon-cup-winner.png alt=แชมป์ประจำฤดูกาลในแต่ละลีก/ถ้วย title=แชมป์ประจำฤดูกาลในแต่ละลีก/ถ้วย></td> \r\n\
                                                        <td> <input type=number name=quantity min=0.5 value=1 id=star" + json[i]['matches'].id + " onkeypress='return isNumber(event)'  > </td>  \r\n\
                                                        <td style=display:block>para," + json[i]['matches'].leagueName + "," + json[i]['matches'].id + "," + Currentteamhandycap + "," + pricehandycap + "," + json[i]['matches'].liveA + ", </td>  \r\n\
                                                        <td> <button name=submit type=submit id=contact-submit onclick=savegame(" + json[i]['matches'].id + ")>ok</button> </td> </tr>");



                        }

                     }
                     if (func != undefined) {
                         func();
                     }
                     //func(leagueid);

                     //$('table').trigger('footable_resize'); 
                     //$('table').trigger('footable_setup_paging');
                 }
             });
        }


        function getbetresult() {
            $.ajax({
                url: 'SSEHandler.ashx',
                type: 'GET',
                dataType: 'json',
                data: { method: 'getresultpoint', memid: 1, matchid: 848 },
                success: function (json) {
                    alert(json);
                }
            });
        }

</script>
<!-- Scripts--> 
<script>
    document.write('<script src=' +
	('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') +
	'.js><\/script>')
</script>
<script src="/js/foundation/foundation.js"></script>
<!--<script src="/js/foundation/foundation.alerts.js"></script> -->
<!--<script src="/js/foundation/foundation.clearing.js"></script> -->
<!--<script src="/js/foundation/foundation.cookie.js"></script> -->
<!--<script src="/js/foundation/foundation.dropdown.js"></script> -->
<!--<script src="/js/foundation/foundation.forms.js"></script> -->
<!--<script src="/js/foundation/foundation.joyride.js"></script> -->
<!--<script src="/js/foundation/foundation.magellan.js"></script> -->
<script src="/js/foundation/foundation.orbit.js"></script>
<!--<script src="/js/foundation/foundation.placeholder.js"></script> -->
<!--<script src="/js/foundation/foundation.reveal.js"></script> -->
<!--<script src="/js/foundation/foundation.section.js"></script> -->
<!--<script src="/js/foundation/foundation.tooltips.js"></script> -->
<script src="/js/foundation/foundation.topbar.js"></script>
<!--  <script src="/js/foundation/foundation.interchange.js"></script> -->
<script src="/js/jquery.easing.1.3.js"></script>
<script src="/js/jquery.mousewheel-3.0.6.pack.js"></script>
<script src="/js/jquery.simplr.smoothscroll.js"></script>
    <script src="/js/member.js"></script>

<script>
    $(document).foundation();
</script>

    
</body>
</html>